package com.awesome.aidldemo;

import android.os.RemoteException;

import com.awesome.aidldemo.bean.DownloadBean;

/**
 * Author: zhangjingfang
 * Email:zhangjingfang@jeejio.com
 * Date: 2022/7/1
 * Description: 下载管理类
 */
public class DownloadManager extends IDownloadManager.Stub{
    private AidlService mAidlService;

    public DownloadManager(AidlService aidlService) {
        mAidlService = aidlService;
    }

    @Override
    public DownloadBean getDownloadBean() throws RemoteException {
        return new DownloadBean("pikaqiu",1024);
    }

    public void download(){
        OnDownloadListener onDownloadListener = mAidlService.getOnDownloadListener();
        try {
            onDownloadListener.download(new DownloadBean("aotemen", 2048));
            onDownloadListener.onFileCount(3);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}
